Exponential Fits using fit_pandas_GUI()

You can try this notebook live by lauching it in Binder.This can take a while to launch, be patient. Binder.

Two Laser Induced Fluoresence (LIF) signals from quinine sulfate in sulfuric acid measured at a wavelenth of 480 nm are analyzed below.

First we import the data sets into pandas dataframes:

To facilitate plotting and analysis we will import the pandas_GUI package:

Let's make a quick plot to look at the raw data, using the plot_pandas_GUI()

This was done by running the command plot_pandas_GUI() in an empty code cell. The code and plot created are shown in the cell after this one. To learn more about using the plot_pandas_GUI() start with the step-by-step example.

Figure 1: A plot of the two signals. Notice that LIF2 exhibits a step at the base of the decay (17 to 30 ns). This is due to a small secondary pulse of the excitation laser, after the initial signal has started to decay. The LIF1 data is impacted much less by the small secondary pulse.

Example 1: Fitting the slower decay (LIF1) using the fit_pandas_GUI()

The fit was done by running the command fit_pandas_GUI() in an empty code cell.

1. On the first tab

the data set, which columns contained the X- and Y-data and a name for the trace were chosen.

Fit_tab_1

2. On the second tab

the the default 'none' value was kept for uncertainties.

Fit_tab_2

3. On the third tab

the 'Exponential' model was chosen from the pop-up menu. The default initial guesses were used.

Fit_tab_3

4. On the fourth tab

the range of data was selected by clicking on the first and last point in the range to fit.

Fit_tab_4

5. On the fifth tab

the axes titles were entered and the 'mirror axes' box checked.

Fit_tab_5

6. On the last (sixth) tab

the final checks were done and then the 'Do Fit' button was clicked, closing the GUI and running the code in the cell below to perform the fit and display the results.

Fit_tab_6

Fit 1: In this case the whole decay from the peak to the end of the data set was fit. Notice that the fit equation including estimated errors of the fit parameters is displayed as a typeset equation. The residuals suggest there is significant noise on the early part of the signal, possibly because the laser pulse did not shut off completely. There is also a signal between 150 and 200 ns, that appears to be a reflection of the signal in the cabling due to a slight mismatch of the termination impedence.

Example 2: Fitting the faster decay

The code and fit below were generated the same way as example 1, but using the faster decaying LIF2 data set.

Fit 2: Again the fit region is from the beginning of the decay to the end of the data set. Notice that the fit is skewed by the blip at the base of the primary decay caused by the secondary pulse of the laser.

Example 3: Fitting the faster decay, but ignoring the blip from the secondary laser pulse

The blip disrupts the data pretty badly, so trying to fit around it probably does not yield particularly good results, but this example used the data to illustrate how to fit to discontiguous regions of a data set.

Everything was done exactly the same as in the first two examples except that two fit ranges, before the blip and after the blip, were defined on tab 4 by selecting two additional points as shown in the figure below. Consecutive pairs of points starting from the lowest point index define the fit ranges.

Discontiguous Fit

Fit 3: A fit ignoring some of the region containing the blip. You can see that the fit to the initial part of the decay is better, but not perfect. Ignoring the blip is not adequate to account for the multiple pulses from the laser.

Fit 4: The same fit as Fit 3, but checking the 'Extend Fit' box. The dashed fit line indicates regions that were not fit. The fit and residuals are show for the whole range of the data set. If you are in a live notebook and zoom in you can see that the fit is the same as before. Additional zooming of the residuals is necessary to see details of them.